package com.distribute.framework.dao;

import java.util.List;
import java.util.Map;

import com.distribute.framework.core.util.Function;
import com.distribute.framework.core.web.util.Page;
import com.distribute.framework.model.SrvHost;

/**
 * 授权商户的Dao接口
 * @author 飞啊飘啊
 */
@SuppressWarnings("unchecked")
public interface ISrvHostDao
{
	/**
	 * 获取所有授权商户
	 * @return
	 */
	public List<SrvHost> getSrvHostList(Map params,Integer offset,Integer size);

	/**
	 * 获取授权商户统计
	 * @return
	 */
	public List getSrvHostStats(Map params,Map<String,Object> groups,Map<String,Object> sums);

	/**
	 * 获取授权商户总数
	 * @return
	 */	
	public Long getSrvHostCount(Map params);
	
	/**
	 * 获取授权商户自定义求和表达式,比如求和:eval="sum(id)"
	 * @return
	 */	
	public <T> T getSrvHostEval(String eval,Map params);
	
	/**
	 * 获取授权商户分页
	 * @return
	 */	
	public Page getSrvHostPage(int page,int size,Map params);
	
	/**
	 * 根据查询条件取授权商户
	 * @param params
	 * @return
	 */
	public SrvHost getSrvHost(Map params);	

	/**
	 * 根据ID取授权商户
	 * @param id
	 * @return
	 */
	public SrvHost getSrvHostById(Long id);


	
	

	/**
	 * 保存授权商户
	 * @param srvHost
	 */
	public SrvHost saveSrvHost(SrvHost srvHost);

	/**
	 * 更新授权商户
	 * @param srvHost
	 */
	public int updateSrvHost(SrvHost srvHost);
	/**
	 * 更新授权商户非空字段
	 * @param srvHost
	 */
	public int updateSrvHost$NotNull(SrvHost srvHost);

	/**
	 * 根据ID删除一个授权商户
	 * @param id
	 */
	public void deleteSrvHostById(Long id);
	/**
	 * 根据ID逻辑删除一个授权商户
	 * @param id
	 */
	public void removeSrvHostById(Long id);
	/**
	 * 根据条件更新授权商户
	 * @param values
	 * @param params
	 */
	public int updateSrvHostByConfirm(Map values, Map params);
	/**
	 * 根据条件删除授权商户
	 * @param params
	 */
	public void deleteSrvHostByConfirm(Map params);
	
	/**
	 * 执行过程，以便事务回滚
	 * @param function
	 */
	public <T> T executeTransaction(Function function);

}